<%-- 
    Document   : RegisterService
    Created on : Sep 6, 2013, 10:40:58 AM
    Author     : Thanh
--%>
<%@page import="java.util.HashMap"%>
<%@page import="java.util.Iterator"%>
<%@page import="java.util.Set"%>
<%@page import="java.text.SimpleDateFormat"%>
<%@page import="java.util.Date"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <link type="text/css" href="css/registerStyle.css" rel="stylesheet">
        <title>JSP Page</title>
        <script>
            function CheckValid()
            {
                var cardNo = frmService.txtCardNo.value;
                var reg = "\\d+";
                var n = cardNo.match(reg);
                if (cardNo === "") {
                    alert(' Enter your card number! ');
                    frmService.txtCardNo.focus();
                    return false;
                }
                else if (!n) {
                    alert(' Card number must be a number ');
                    frmService.txtCardNo.focus();
                    return false;
                }
                return true;
            }
        </script>
    </head>
    <body>        
        <%
            /*HashMap hm = (HashMap) request.getSession().getAttribute("Charges_data");
             Set charge = hm.keySet();
             Iterator itr = charge.iterator();*/
            Date today = new Date(System.currentTimeMillis());
            SimpleDateFormat dateFormat = new SimpleDateFormat("MM/dd/yyyy");
            String todayStr = dateFormat.format(today.getTime());
            String username = (String) request.getSession().getAttribute("login");
        %>        
        <table border="0" width="70%">
            <tr>
                <td valign="top" width="30%">                    
                </td>
                <td>    <form name="frmService" method="POST" action="RegisterServiceServlet">                
                        <table border="0">
                            <thead>
                                <tr>
                                    <th colspan="2" align="left">Register Service</th>                                
                                </tr>
                            </thead>
                            <tbody>
                                <tr>
                                    <td>Charge ID:</td>
                                    <td><select name="ddlChargeID" class="styled-select">
                                            <option>1</option>
                                            <option>2</option>
                                            <option>3</option>
                                        </select></td>
                                </tr>
                                <tr>
                                    <td>Username:</td>
                                    <td><input type="text" name="txtUserid" value="<%out.println(username);%>" readonly="readonly" class="textbox"/></td>
                                </tr>
                                <tr>
                                    <td>Date:</td>
                                    <td><input type="text" name="txtDate" value="<%out.println(todayStr);%>" readonly="readonly" class="textbox"/></td>
                                </tr>
                                <tr>
                                    <td>Card No.:</td>
                                    <td><input type="text" name="txtCardNo" value="" class="textbox"/></td>
                                </tr>
                                <tr>
                                    <td>Card Type:</td>
                                    <td><select name="ddlCardType" class="styled-select">
                                            <option>Visa</option>
                                            <option>Master Card</option>
                                            <option>ATM</option>
                                        </select></td>
                                </tr>
                                <tr>
                                    <td></td>
                                    <td><input type="submit" value="Submit" class="button" onclick="return CheckValid();"/></td>
                                </tr>
                            </tbody>
                        </table> </form>                   
                </td>
            </tr>
        </table>    
    </body>
</html>
